package priv.pattern.staticproxy.dynamicagency;

import priv.pattern.staticproxy.dynamicagency.service.ITeacherDao;
import priv.pattern.staticproxy.dynamicagency.service.impl.TeacherDao;

/*
 * 作者：m鹏h
 * 时间；2024/7/30 17:18
 * 描述：动态代理测试类
 **/
public class ClientTest {
 public static void main(String[] args) {
  //创建目标对象
  ITeacherDao target = new TeacherDao();

  //创建代理对象
  ITeacherDao proxyInstance = (ITeacherDao)new ProxyFactory(target).getProxyInstance();

  //内存中动态生成了代理对象
  System.out.println(proxyInstance.getClass());

  //通过代理对象，调用目标对象的方法
  proxyInstance.teach();
  proxyInstance.tesst("一键三连");
 }
}

